package me.zhengjie.modules.fund.repository;

import me.zhengjie.modules.fund.domain.UserFund;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;

import java.util.List;
import java.util.Set;

public interface UserFundRepository extends JpaRepository<UserFund, Long>, JpaSpecificationExecutor<UserFund> {

    /**
     * 根据Id删除
     *
     * @param ids /
     */
    void deleteAllByIdIn(Set<Long> ids);

    /**
     * 根据userId和code查询
     *
     * @param userId
     * @param code
     * @return
     */
    UserFund findByUserIdAndFundCode(Long userId, String code);

    /**
     * 根据fundCode获取指定基金的用户基金明细
     *
     * @param fundCode
     * @return
     */
    List<UserFund> findByFundCode(String fundCode);
}
